### --- Test setup ---
if(FALSE) {
	## Not really needed, but can be handy when writing tests
	library("RUnit")
	library("unsupervisedMicroarray")
}

#data for tests
library(rda)
data(brain)
data(iris)
irDat <- as.matrix(iris[,-5])
irC <- as.numeric(iris[,5])

bx <- brain.x[,70:100]
by <- brain.y
mm<-(matrix(runif(100),ncol=5))
mmC <- c(rep(1,10),rep(2,10)) 


test.OutSetFormat_Reducer <-function(){
	#PCA
	kgdc <- new("KGDimChooser",1,1)
	bsdc <- new("BStickDimChooser",1,1)
	
	pcar <-new("PCAReducer",kgdc,TRUE,FALSE)
	rlC <- new("ReduceListComputer",pcar)
	
	
	reduced <-computeList(rlC,list(X=mm))
	checkIdentical(class(reduced$X),class(mm))
	checkTrue(dim(reduced$X)[1] == dim(mm)[1])
	checkTrue(dim(reduced$X)[2] <= dim(mm)[2])
	
}

test.OutSetFormat_ReducerCluster <-function(){
	#PCA
	kgdc <- new("KGDimChooser",1,1)
	bsdc <- new("BStickDimChooser",1,1)
	
	pcar <-new("PCAReducer",kgdc,TRUE,FALSE)
	phcl <- new("HierParamClusterAlg",3)
	rlC <- new("ReduceClustListComputer",pcar,phcl)
	
	
	clusters <-computeList(rlC,list(X=mm))
	checkTrue(class(clusters$clusters)=="numeric")
	checkTrue(length(clusters$clusters)==length(mmC))
	
}
